namespace PHSRAG.Insight21.Agreements.Controls
{
	using System;
	using System.Data;
	using System.Drawing;
	using System.Web;
	using System.Web.UI.WebControls;
	using System.Web.UI.HtmlControls;
	using PHSRAG.Insight21.SearchContext;
  	/// <summary>
	///	Summary description for TransactionOverviewSearch.
	/// </summary>
	public partial class TransactionOverviewSearch : System.Web.UI.UserControl
	{

        // Delegate declaration
        //public delegate void OnSearchEvent(SearchCriteriaArgs args);

        // Event declaration
       // public event OnSearchEvent OnSearch;


        protected void Page_Load(object sender, System.EventArgs e)
		{
			// Put user code to initialize the page here
			System.Diagnostics.Trace.WriteLine("Begin - TransactionOverviewSearch Control::OnLoad event.");

			((WebControls.ExpansionToggler)expandingPanel.FindControl("expansionToggler")).HelpText = 
				InsightUtilities.Constants.SearchHelpText;

			if (!IsPostBack)
				expandingPanel.IsExpanded = true;
		}

		#region Web Form Designer generated code
		override protected void OnInit(EventArgs e)
		{
			//
			// CODEGEN: This call is required by the ASP.NET Web Form Designer.
			//
			InitializeComponent();
			base.OnInit(e);
		}
		
		/// <summary>
		///		Required method for Designer support - do not modify
		///		the contents of this method with the code editor.
		/// </summary>
		private void InitializeComponent()
		{
		}
		#endregion

		#region Search

		/// <summary>
		/// Handler for the event raised by the CommonSearch control when the "Clear Selection" buttion is clicked upon.
		/// The control clears the criretria (specific to this module).
		/// Since in the page life-cycle, the Load occurs before the Clear event, we have to instigate a re-load of the
		/// data grid to refelect the fact that the search criteria has been cleared.
		/// </summary>
		/// <param name="sender">Sender of the event</param>
		/// <param name="e">Argument associated with the event</param>
		protected void OnClearSelection(object sender, CommandEventArgs e)
		{
			System.Diagnostics.Trace.WriteLine("Begin - TransactionOverviewSearch - OnClearSelection");
			expandingPanel.IsExpanded = true;

            RaiseBubbleEvent(this, e);
		}

        ///// <summary>
        ///// Event handler for the CommonSearch control.
        ///// Make sure to set the class name properties on search, this is necessary to set 
        ///// to check to see if user has selected Journal Entry order type,
        ///// calls private LoadControl method to load information based on search filters,
        ///// Collapse the Search Pannel once the information is loaded,
        ///// </summary>
        ///// <param name="args">Argument associated with the event (contains the search criteria dictionary)</param>
        public void OnSearch(SearchCriteriaArgs args)
        {
            System.Diagnostics.Trace.WriteLine("Begin - TransactionOverviewSearch - OnSearch");
            RaiseBubbleEvent(this, args); 
          
        }
		#endregion
	}
}
